exports.install = function (Vue, options) {
  function pwdConfirm(cb, controlLevel) {
    let v = this;
    let promptInfo = `请输入密码`;
    this.$prompt(promptInfo, "提示", {
      confirmButtonText: "确定",
      cancelButtonText: "取消",
      inputErrorMessage: "长度为3-20的所有字符",
      inputPattern: /^.{3,20}$/,
      closeOnClickModal: false,
      customClass: "messageBox-prompt-test confirm",
      inputType: "password"
    }).then(({value}) => {
      this.$axios.post("user", {
        actionType: "userPwdVerify",
        password: value
      }).then(function (response) {
        let data = response.data;
        if (data.success) {
          cb.call(null, data);
        } else {
          v.$message({
            type: "info",
            message: data.message
          });
        }
      });
    }).catch((e) => {
      this.$message({
        type: "info",
        message: e
      });
    });
  }

  function showMessage(message, messageType) {
    this.$message({
      message: message,
      type: messageType
    });
  }

  Vue.prototype.$baseConfirm = function baseConfirm(textInfo, cb) {
    this.$confirm(textInfo, '提示', {
      confirmButtonText: '确认',
      cancelButtonText: '取消',
      type: "warning",
      customClass: "confirm"
    }).then(() => {
      cb.call(null, true);
    }).catch(() => {

    });
  };
  Vue.prototype.pwdConfirm = pwdConfirm;
  Vue.prototype.showMessage = showMessage;
}